﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ChildEdit.aspx.cs" Inherits="HumanResorcesProj.GUI.Extensions.ChildEdit" MasterPageFile="~/GUI/MasterChild.Master" %>

<asp:Content ID="Content1" runat="server" 
    contentplaceholderid="ContentPlaceHolder1">

       <div style="background-image: url('../pic/MainWindow/MainWindow94.png'); background-repeat: no-repeat; width: 794px; height: 266px;">
           <table style="width: 100%;" dir="rtl">
               <tr>
                   <td style="width: 46px">
                       &nbsp;
                   </td>
                   <td>
                       <div>
                           <table style="width:100%;">
                               <tr>
                                   <td style="width: 299px">
                                       <b>שם העובד:</b><asp:Label ID="Label1" runat="server" Font-Bold="True" 
                                           Font-Underline="True" Text="Label"></asp:Label>
                                   </td>
                                   <td>
                                       <b>ת&quot;ז:<asp:Label ID="Label2" runat="server" Font-Bold="True" 
                                           Font-Underline="True" Text="Label"></asp:Label>
                                       </b>
                                   </td>
                               </tr>
                           </table>
                       </div>
                   </td>
                   <td>
                       &nbsp;
                   </td>
               </tr>
               <tr>
                   <td style="width: 46px">
                       &nbsp;
                   </td>
                   <td>
                       &nbsp;
                       <asp:GridView ID="GridView1" runat="server" AllowPaging="True" 
                           AllowSorting="True" AutoGenerateColumns="False" DataKeyNames="EmpId,childId" 
                           DataSourceID="SqlDataSource1" Width="670px" CellPadding="2" 
                             
                           ForeColor="Black" GridLines="None" PageSize="6" 
                           onrowdeleted="GridView1_RowDeleted" BackColor="LightGoldenrodYellow" 
                           BorderColor="Tan" BorderWidth="1px" HorizontalAlign="Right" 
                           style="text-align: center">
                           <Columns>
                               <asp:TemplateField ShowHeader="False">
                                   <EditItemTemplate>
                                       <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="True" 
                                           CommandName="Update" Text="עדכן"></asp:LinkButton>
                                       &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                       <asp:LinkButton ID="LinkButton2" runat="server" CausesValidation="False" 
                                           CommandName="Cancel" Text="בטל"></asp:LinkButton>
                                   </EditItemTemplate>
                                   <ItemTemplate>
                                       <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="False" 
                                           CommandName="Edit" Text="ערוך"></asp:LinkButton>
                                       &nbsp;<asp:LinkButton ID="LinkButton2" runat="server" CausesValidation="False" 
                                           CommandName="Delete" 
                                          OnClientClick="return confirm('נא אשר מחיקה');" 
                                           Text="מחק"></asp:LinkButton>
                                   </ItemTemplate>
                               </asp:TemplateField>
                               <asp:BoundField DataField="EmpId" HeaderText="EmpId" ReadOnly="True" 
                                   SortExpression="EmpId" Visible="False"></asp:BoundField>
                               <asp:BoundField DataField="childId" HeaderText="תז" ReadOnly="True" 
                                   SortExpression="childId" />
                               <asp:BoundField DataField="childName" HeaderText="שם" 
                                   SortExpression="childName" />
                               <asp:BoundField DataField="ChildBirthDate" HeaderText="תאריך לידה" 
                                   SortExpression="ChildBirthDate" />
                               <asp:TemplateField HeaderText="מין" SortExpression="childGender">
                                   <EditItemTemplate>
                                       <asp:DropDownList ID="DropDownList1" runat="server" Height="22px" 
                                           SelectedValue='<%# Bind("childGender") %>' Width="128px">
                                           <asp:ListItem>--בחר--</asp:ListItem>
                                           <asp:ListItem>זכר</asp:ListItem>
                                           <asp:ListItem>נקבה</asp:ListItem>
                                       </asp:DropDownList>
                                   </EditItemTemplate>
                                   <ItemTemplate>
                                       <asp:Label ID="Label1" runat="server" Text='<%# Bind("childGender") %>'></asp:Label>
                                   </ItemTemplate>
                               </asp:TemplateField>
                           </Columns>
                           <FooterStyle BackColor="Tan" />
                           <PagerStyle BackColor="PaleGoldenrod" ForeColor="DarkSlateBlue" HorizontalAlign="Center" 
                               CssClass="pgr" />
                           <SelectedRowStyle BackColor="DarkSlateBlue" ForeColor="GhostWhite" />
                           <HeaderStyle BackColor="Tan" Font-Bold="True" />
                           <AlternatingRowStyle BackColor="PaleGoldenrod" CssClass="alt" />
                       </asp:GridView>
                       <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
                           ConflictDetection="CompareAllValues" 
                           ConnectionString="<%$ ConnectionStrings:Eden-DatabaseConnectionString3 %>" 
                           DeleteCommand="DELETE FROM [ChildrenTable] WHERE [EmpId] = @original_EmpId AND [childId] = @original_childId " 
                           InsertCommand="INSERT INTO [ChildrenTable] ([EmpId], [childId], [childName], [ChildBirthDate], [childGender]) VALUES (@EmpId, @childId, @childName, @ChildBirthDate, @childGender)" 
                           OldValuesParameterFormatString="original_{0}" 
                           SelectCommand="SELECT * FROM [ChildrenTable] WHERE ([EmpId] = @EmpId)" 
                           
                           UpdateCommand="UPDATE [ChildrenTable] SET [childName] = @childName, [ChildBirthDate] = @ChildBirthDate, [childGender] = @childGender WHERE [EmpId] = @original_EmpId AND [childId] = @original_childId ">
                           <SelectParameters>
                               <asp:ControlParameter ControlID="label2" Name="EmpId" PropertyName="Text" 
                                   Type="String" />
                           </SelectParameters>
                           <DeleteParameters>
                               <asp:Parameter Name="original_EmpId" Type="String" />
                               <asp:Parameter Name="original_childId" Type="String" />
                           </DeleteParameters>
                           <UpdateParameters>
                               <asp:Parameter Name="childName" Type="String" />
                               <asp:Parameter Name="ChildBirthDate" Type="String" />
                               <asp:Parameter Name="childGender" Type="String" />
                               <asp:Parameter Name="original_EmpId" Type="String" />
                               <asp:Parameter Name="original_childId" Type="String" />
                           </UpdateParameters>
                           <InsertParameters>
                               <asp:Parameter Name="EmpId" Type="String" />
                               <asp:Parameter Name="childId" Type="String" />
                               <asp:Parameter Name="childName" Type="String" />
                               <asp:Parameter Name="ChildBirthDate" Type="String" />
                               <asp:Parameter Name="childGender" Type="String" />
                           </InsertParameters>
                       </asp:SqlDataSource>
                   </td>
                   <td>
                       &nbsp;
                   </td>
               </tr>
               </table>
           </br>
        
       
       </div> 
                             

</asp:Content>

 
